<?php



class TodaysDateAndTime
{
	
	/**
	 * @return string, tid , dag månad o år.
	 */
	public function GetTodaysDate()
	{
		$timeAndDate = $this->GetTimeAndDateArray();	

		$year = $timeAndDate['year'];	 
		$mday = $timeAndDate['mday']; // 1-31	 
		
		$time = $this->GetTime(); 
		$wday = $this->GetTodaysDayInSwedish(); 				
		$month = $this->GetTodaysMonthInSwedish();
		
		return $wday . ", den " . $mday . " " . $month. " år "
		     . $year . ". Klockan är [" . $time . "].";
	}


	/**
	 * @return date obj 
	 */
	private function GetTimeAndDateArray()
	{
		return getdate();
	}

	/**
	 * @return string - veckodag
	 */
	private function GetTodaysDayInSwedish()
	{
		$timeAndDate = $this->GetTimeAndDateArray();
		$wday = $timeAndDate['wday'];
		
		$weekDay = array(
	    0    => "Söndag",  1    => "Måndag",
	    2    => "Tisdag",  3    => "Onsdag",
	    4    => "Torsdag", 5    => "Fredag",
	    6    => "Lördag",
		);
		
		$wday = $weekDay[$wday];
		return $wday;
	}
	
	/**
	 * @return string
	 */
	private function GetTodaysMonthInSwedish()
	{
		$timeAndDate = $this->GetTimeAndDateArray();
		$month = $timeAndDate['mon'];
		 
		 
		$allMonths = array( 
	     1  => "Januari",    2    => "Februari",
	     3  => "Mars",  		4    => "April",
	     5  => "Maj",   		6    => "Juni",
	     7  => "Juli",   	8    => "Augusti",
	     9  => "September", 10    => "Oktober",
	    11  => "November",  12    => "December",
		);
		
		$month = $allMonths[$month];
		return $month;
		
	}
	
	/**
	 * @return string
	 */
	private function GetTime()
	{
		$dateAndTime = $this->getTimeAndDateArray();
		
		return $dateAndTime['hours']. ":" . $dateAndTime['minutes'].
		 ":" . $dateAndTime['seconds'];
		
	}

}
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	